package com.itechart.watchfacts.service.impl;

import com.itechart.watchfacts.dao.GeneralDAO;
import com.itechart.watchfacts.dao.orm.HibernateGeneralDAO;
import com.itechart.watchfacts.service.GeneralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: E.Krasnotschek
 * Date: 7/25/13
 * Time: 10:29 AM
 * To change this template use File | Settings | File Templates.
 */
public  class GeneralServiceImpl<T> implements GeneralService<T>{

    protected GeneralDAO<T> dao;

    @Autowired
    public void setDao(HibernateGeneralDAO<T> daoToSet){
        dao = daoToSet;
    }

    @Override
    @Transactional
    public List<T> list() {
        return dao.list();
    }

    @Override
    @Transactional
    public void create(T entry) {
        dao.create(entry);
    }

    @Override
    @Transactional
    public void delete(int id) {
        dao.delete(id);
    }
}
